﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.XSchEmA.Comparer;
using Pixysoft.Framework.XSchEmA.Entity;

namespace Pixysoft.Framework.XSchEmA
{
    public class XSchemaManager
    {
        public static string GLOBAL_FRAMEWORK_ID { get { return StringHelper.global_framework_id; } }

        public static IDbComparer GetComparer()
        {
            return new DatabaseComparer();
        }

        public static IDbSchema GetSchema(DatabaseType type)
        {
            switch (type)
            {
                case DatabaseType.MySql:
                case DatabaseType.MySql4x:
                    return MySqlSchema;
                case DatabaseType.Access:
                case DatabaseType.AccessPwd:
                    return AccessSchema;
                case DatabaseType.Oracle:
                    return OracleSchema;
                case DatabaseType.SQLite:
                    return SQLiteSchema;
                case DatabaseType.SqlServer:
                    return SqlServerSchema;
                case DatabaseType.Unknown:
                default:
                    throw new Exception("unknown database type");
            }
        }

        public static IDbSchema AccessSchema
        {
            get { return new AccessSchema(); }
        }

        public static IDbSchema MySqlSchema
        {
            get { return new MySqlSchema(); }
        }

        public static IDbSchema SqlServerSchema
        {
            get { return new SqlServerSchema(); }
        }

        public static IDbSchema SQLiteSchema
        {
            get { return new SQLiteSchema(); }
        }

        public static IDbSchema OracleSchema
        {
            get { return new OracleSchema(); }
        }
    }
}
